<?php
namespace app\admin\model;

use think\Model;

/**
 * 官网用户模型
 * @package app\admin\model
 */
class GwUser extends Model
{

    public static function getList($request)
    {
        $where = [];
        if ($request['phone'] !== '') {
            $where[] = ['c.phone', 'eq', $request['phone']];
        }

        if ($request['status'] !== '') {
            $where[] = ['c.status', 'eq', $request['status']];
        }
        return self::alias('c')
            ->field('c.*')
            ->where($where)
            ->paginate($request['limit'], false, ['query' => $request])
            ->each(function ($item, $key) {
                switch ($item->status) {
                    case '0':
                        $item->status_ = '<span class="layui-badge status-jy">未处理</span>';
                        break;
                    case '1':
                        $item->status_ = '<span class="layui-badge layui-bg-green status-qy">已处理</span>';
                        break;
                    default:
                        $item->status_ = '<span class="layui-badge layui-bg-orange status-jy">未知</span>';
                        break;
                }
            });
    }
}
